import listener from './Listener'
const root = window

root.jsBridge = {
  send (data, fn) {

  }
}
root.jsBridge2 = {}
root.jsBridge2.receive = (data) => {
  const { event } = data
  event && listener.queue[event] && listener.queue[event](data)
}
window.listener = listener.queue
const _log = root.console.log
root.console.log = (...args) => {
  _log.apply(null, args)
  window.jsBridge.send(JSON.stringify({ jsLog: args }))
}

export default root.jsBridge
